from stack import Stack


def domath(op1, op2, op3):
    if op1 == '*':
        return op2 * op3
    elif op1 == "/":
        return op2 / op3
    elif op1 == '+':
        return op2 + op3
    else:
        return op2 - op3


def post_fix_eval(s: str) -> str:
    operand_stack = Stack()

    token_list = s.split()

    for token in token_list:
         if token in '0123456789':
             operand_stack.push(int(token))

         else:
             operand2 = operand_stack.pop()
             operand1 = operand_stack.pop()
             result = domath(token, operand1, operand2)
             operand_stack.push(result)

    return operand_stack.pop()


if __name__ == '__main__':
    s = ' 4 5 + 3 2 + *'
    print(post_fix_eval(s))
